
# require 'net/pop'
# pop = Net::POP3.new( 'mail.kembo-net.com', 110 )
# pop.start( 'wangzhen@kembo-net.com', 'wangzhen2008' )          ###
# if pop.mails.empty? then
#   puts 'no mail.'
# else
#   i = 0
#   pop.each_mail do |m|   # or "pop.mails.each ..."
# 	File.open( 'inbox/' + i.to_s, 'w' ) {|f|
#       f.write m.pop
#     }
# 
#     i += 1
#   end
#   puts "#{pop.mails.size} mails popped."
# end
# pop.finish                                           ###
# 



require 'rubygems'
require 'tmail'
require 'net/smtp'
require 'tlsmail'

tomail = 'wangzhen@kembo-net.com'
frommail = 'haofeicui.com@gmail.com'
mail = TMail::Mail.new
mail.to = tomail
mail.from = frommail
mail.subject = 'Test message'
mail.date = Time.now
mail.body = 'Thanks to Locaweb for making this possible.'
#Net::SMTP.start('smtp.example.com', 25, 'yourdomain.example.com', 'your_account', 'your_password', :cram_md5)
#Net::SMTP.start( 'mail.kembo-net.com', 25  ,'kembo-net.com' ,'wangzhen@kembo-net.com' ,'wangzhen2008' ,:login) do|smtpclient|
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
Net::SMTP.start( 'smtp.gmail.com', 587  ,'gmail.com' ,'vwangzhen@gmail.com' ,'wangzhen' ,'plain') do|smtpclient|
  smtpclient.send_message(
    mail.to_s,
    frommail,
    tomail
  )
end